﻿{include file="public/header" /}
			<form method="post" class="padding">
				<div class="panel admin-panel">
					<div class="panel-head"><strong>{:lang('currency')['edit']}{:lang('label')['category']}</strong></div>
					<div class="padding border-bottom">
						<a type="button" class="button button border-green addcat" href="#" />{:lang('currency')['add']}{:lang('label')['category']}</a>
					</div>
					<table class="table table-hover">
						<tr>
							<th width="100">{:lang('label')['title']}</th>
							<th width="120">{:lang('label')['sub']}</th>
							<th width="100">{:lang('label')['handle']}</th>
						</tr>
						{volist name="data" id="volist"}
						<tr>
							<td style="line-height:40px">
							{$volist.title}
							</td>
							<td style="line-height:40px">----</td>
							<td style="line-height:40px"><a class="button border-green button-little addcatsub" data-id="{$volist.id}">{:lang('currency')['add']}{:lang('label')['sub']}</a> <a class="button border-blue button-little editcat" data-id="{$volist.id}">{:lang('currency')['edit']}</a> <a class="button border-yellow button-little delcat" data-id="{$volist.id}" >{:lang('currency')['del']}</a></td>
						</tr>
						{volist name="volist.sub" id="sublist"}
						<tr>
							<td style="line-height:40px">
								---->
							</td>
							<td style="line-height:40px">{$sublist.title}</td>
							<td style="line-height:40px"><a class="button border-blue button-little editcat" data-id="{$sublist.id}">{:lang('currency')['edit']}</a> <a data-id="{$sublist.id}" class="button border-yellow button-little delcat" >{:lang('currency')['del']}</a></td>
						</tr>	
						{/volist}
						{/volist}
					</table>
				</div>
			</form>
			<script>
			layer.config({
				extend: 'extend/layer.ext.js'
			}); 
			$('.delcat').click(function(){
				var mythis = $(this)
				var id =  mythis.attr('data-id');
				layer.confirm("{:lang('tip')['category_del']}", {
				  btn: ["{:lang('currency')['status_1']}","{:lang('currency')['status_2']}"] //按钮
				}, function(){
				  $.getJSON("__ROOT__/admin/article/category_del.html?id="+id,function(data){
						if(data.code == 'success'){
							msg(data.msg,1);
							location.reload();
						}
					});
				});
			});
			$('.addcat').click(function(){
				var mythis = $(this)
				layer.prompt({title:'{:lang('currency')['add']}{:lang('label')['category']}'},function(val){
					$.post("__ROOT__/admin/article/category_edit.html",{title:val},function(data){
						if(data.code == 'success'){
							msg(data.msg,1);
							location.reload();
						}
					});
				});
			});
			$('.addcatsub').click(function(){
				var mythis = $(this);
				var gid =  mythis.attr('data-id');
				layer.prompt({title:'{:lang('currency')['add']}{:lang('label')['sub']}{:lang('label')['category']}'},function(val){
					$.post("__ROOT__/admin/article/category_edit.html",{gid:gid,title:val},function(data){
						if(data.code == 'success'){
							msg(data.msg,1);
							location.reload();
						}
					});
				});
			});
			$('.editcat').click(function(){
				var mythis = $(this)
				var id = mythis.attr('data-id');
				layer.prompt({title:'{:lang('currency')['edit']}{:lang('label')['category']}'},function(val){
					$.post("__ROOT__/admin/article/category_edit.html?id="+id,{title:val},function(data){
						if(data.code == 'success'){
							msg(data.msg,1);
							location.reload();
						}
					});
				});
			});
			</script>